home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / VS_804.ARJ / MAINTSRC.EXE / D_DBF.PRG < prev    next >
Text File  |  1991-10-14  |  1KB  |  71 lines

  1. * Filename......: D_Dbf.Prg
  2. *
  3. * Author........: Vernon E. Six, Jr.
  4. *
  5. * Last Update...: Mon  10-14-1991  10:03:25
  6. *
  7. * Notice........: Copyright (c) 1991 by Vernon E. Six, Jr.
  8. *                 All Rights Reserved World Wide
  9. *
  10. * Dialect.......: Clipper v5.0x
  11.  
  12. #include "INKEY.CH"
  13. #include "SETCURS.CH"
  14.  
  15. FUNCTION D_Dbf()
  16. *****
  17. * Delete currently selected DBF
  18. *****
  19. LOCAL n_Button
  20.  
  21.    n_Button = VS_Alert( { PADC("Delete Current Database?",40), ;
  22.                  PADC("Are You Sure?",40) }, { " No ", " Yes " }, 3 )
  23.  
  24.    IF n_Button = 1
  25.       RETURN(NIL)
  26.    ENDIF
  27.  
  28.    BEGIN SEQUENCE
  29.  
  30.       *══ Lock the "one" side of the "one-to-many" ══════════════*
  31.  
  32.       IF .NOT. _DICTHDR->( VS_RLock() )
  33.          BREAK
  34.       ENDIF
  35.  
  36.  
  37.       *══ Delete the index records ══════════════════════════════*
  38.  
  39.       DO WHILE _DICTNTX->( dbSeek( _DICTHDR->DBF_NAME ) )
  40.  
  41.          IF .NOT. _DICTNTX->( VS_DelRec() )
  42.             BREAK
  43.          ENDIF
  44.  
  45.       ENDDO
  46.  
  47.  
  48.       *══ Delete the fields ═════════════════════════════════════*
  49.  
  50.       DO WHILE _DICTFLD->( dbSeek( _DICTHDR->DBF_NAME ) )
  51.  
  52.          IF .NOT. _DICTFLD->( VS_DelRec() )
  53.             BREAK
  54.          ENDIF
  55.  
  56.       ENDDO
  57.  
  58.  
  59.       *══ Now delete the header record ══════════════════════════*
  60.  
  61.       IF .NOT. _DICTHDR->( VS_DelRec() )
  62.          BREAK
  63.       ENDIF
  64.  
  65.    END SEQUENCE
  66.  
  67. RETURN(NIL)
  68. *** EOF: D_Dbf() ************************************************************
  69.  
  70.  
  71.